package com.dev.view.tab1;


import android.support.v4.app.Fragment;
import android.support.v4.widget.SwipeRefreshLayout;

import com.dev.R;
import com.dev.bean.FragmentTab1Response;
import com.dev.view.common.wdiget.listviewloadmore.LoadMoreListView;
import com.dev.view.tab1.adapter.FragmentTab1Adapter;

import org.androidannotations.annotations.AfterViews;
import org.androidannotations.annotations.EFragment;
import org.androidannotations.annotations.ViewById;

import java.util.ArrayList;
import java.util.List;

@EFragment(R.layout.fragment_tab1)
public class FragmentTab1 extends Fragment {

    @ViewById(R.id.swiperefresh_view)
    SwipeRefreshLayout swipeRefreshLayout;

    @ViewById(R.id.load_more_list_view)
    LoadMoreListView loadMoreListView;

    private FragmentTab1Adapter adapter;


    @AfterViews
    public void initView() {
        initData();
    }

    private void initData() {
        List<FragmentTab1Response> list = new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            FragmentTab1Response response = new FragmentTab1Response();
            response.img_icon = R.mipmap.ic_launcher;
            response.tv_name = "测试" + i;
            response.tv_content = "测试内容" + i;
            list.add(response);
        }
        adapter = new FragmentTab1Adapter(getContext());
        adapter.addAllData(list);
        loadMoreListView.setAdapter(adapter);
    }


}
